package com.doctor.web.controller;

import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.doctor.database.service.PatientService;
import com.doctor.utils.ServletUtil;

@Controller
@RequestMapping(value="/patient")
public class PatientContorller {
	
	@Autowired
	PatientService patientService;
	
	@RequestMapping(value="/app_query_patients.do")
	@ResponseBody
	public Map queryPatients(HttpServletRequest httpRequest){
		return patientService.queryPatients(ServletUtil.getReqParaMap(httpRequest));
	}
	
	@RequestMapping(value="/app_add_patient.do")
	@ResponseBody
	public Map addPatient(String patient){
		return patientService.create(patient);
	}

	@RequestMapping(value="/app_delete_patient.do")
	@ResponseBody
	public Map deletePatient(String id){                                        
		return patientService.deletePatient(Long.parseLong(id));
	}
}
